home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 5 / Apprentice-Release5.iso / Source Code / C++ / Snippets / LaunchCreator 1.1 / vlauncher.cc < prev    next >
C/C++ Source or Header  |  1996-06-09  |  944b  |  33 lines

  1. //        A simple program that tests open_selection()
  2.  
  3. /* MacHeaders Included */
  4. #include "mymenv.h"
  5. const char * get_full_path(AliasHandle alias_handle);
  6.  
  7. void main()
  8. {
  9.     Initialize_MAC();
  10.     alert("about to open the source code of itself");
  11.     open_selection("vlauncher.cc");
  12.     
  13.     notify_and_wait("About to open the Host file in the system folder");
  14.     long system_dir_id;
  15.     short volume_refno;
  16.     do_well( ::FindFolder(kOnSystemDisk,kSystemFolderType,kDontCreateFolder,
  17.                          &volume_refno,&system_dir_id) );
  18.     FSSpec file_spec;
  19.       do_well(FSMakeFSSpec(volume_refno,system_dir_id,"\pHOSTS",&file_spec));
  20.     open_selection(file_spec);
  21.  
  22.     notify_and_wait("About to \"click\" on the 'Startup Items' folder");
  23.     {
  24.         do_well(FSMakeFSSpec(volume_refno,system_dir_id,"\pStartup Items",&file_spec));
  25.         AliasHandle alias;
  26.         do_well( NewAlias(0,&file_spec,&alias) );
  27.  
  28.       open_selection(get_full_path(alias));
  29.       DisposHandle((Handle)alias);
  30.     }
  31.     
  32.     alert("Done");
  33. }